package edums.student.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import edums.student.dto.StudentDataDTO;

public class StudentDataDAOImpl implements StudentDataDAO {
	private SqlMapClientTemplate client;
	public StudentDataDAOImpl(SqlMapClientTemplate client){
		this.client = client;
	}
	
	@Override
	public void insertStudentData(StudentDataDTO sddto) throws SQLException{
		client.insert("studentData.insertStudentData", sddto);
	}

	@Override
	public void updateStudentData(StudentDataDTO sddto) throws SQLException {
		client.update("studentData.updateStudentData", sddto);
	}
	
	@Override
	public void deleteStudentDataFileByNo(Map studentDataInfo)
			throws SQLException {
		client.update("studentData.deleteStudentDataFileByNo", studentDataInfo);
	}

	@Override
	public void deleteStudentDataByNo(Map studentDataInfo) throws SQLException {
		client.delete("studentData.deleteStudentDataByNo", studentDataInfo);
	}

	@Override
	public void updateStudentDataViewCountByNo(Map studentDataInfo)
			throws SQLException {
		client.update("studentData.updateStudentDataViewCountByNo", studentDataInfo);
	}
	
	@Override
	public int selectStudentDataNo(String studentId) throws SQLException{
		return (Integer) client.queryForObject("studentData.selectStudentDataNo", studentId);
	}
	
	@Override
	public StudentDataDTO selectStudentDataByNo(Map studentDataInfo) throws SQLException{
		return (StudentDataDTO) client.queryForObject("studentData.selectStudentDataByNo", studentDataInfo);
	}

	@Override
	public List selectAllStudentData(Map studentDataInfo) throws SQLException {
		return client.queryForList("studentData.selectAllStudentData", studentDataInfo);
	}
	@Override
	public int selectStudentDataTotalContent(Map studentDataInfo) throws SQLException {
		
		return (Integer) client.queryForObject("studentData.selectStudentDataTotalContent", studentDataInfo);
	}

}
